/**
 * Header
 */

 import eventHelper from "../../../../utils/EventHelper";

 import React,{Component} from "react";
 import consts from "../../../../consts/consts";
 
 class Header extends Component{
    handleOnHideItem(){
        const {data,updateWidget,setState} = this.props;
        data.visible = !data.visible;
        
        setState({selectedWidget: data});
        updateWidget(data);
        eventHelper.trigger(consts.EVENTS.THREED_WIDGET_VISIBILITY_CHANGED, data);
    }
    render(){
        var data = this.props.data;
        var name = data.label;
        return (
            <div className="template-header">
                <div className="namespace">
                    { name }
                </div>
                <div onClick={() => this.handleOnHideItem()} className="action">
                    <div className={"action-icon " + (data.visible ? "icon-blur" : "icon-focus")}></div>
                    <span>{$._("Hide")}</span>
                </div>
            </div>
        )
    }
 }

 module.exports = Header;
